package src.itheima01;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;

/**
 * @author xxx
 * @date 2020/12/22 16:27
 * @description
 */
public class Test {
    public static void main(String[] args) throws IOException {
     //以500个字节每次读取读取一个文件的中的字节，循环展示输出
        FileInputStream fileInputStream=new FileInputStream("D:\\java349\\day11\\from\\f1.txt");
        byte[] bytes=new byte[500];

        int t=0;

        while ((t=fileInputStream.read(bytes))!=-1) {

            System.out.println(new String(bytes,0,t));
            System.out.println("---------------------");
        }
     //复制一个文件所有内容到另一个空文件(以每次10字节速度)

        FileInputStream fileInputStream1=new FileInputStream("D:\\java349\\day11\\dest\\coder_must2.flv");
        FileOutputStream fileInputStream2=new FileOutputStream("D:\\java349\\day11\\dest\\coder_must3.flv");


        byte[] bytes1=new byte[10];
        int b=0;
        while ((b=fileInputStream1.read(bytes1))!=-1){
          fileInputStream2.write(bytes1,0,b);


        }

        fileInputStream.close();
        fileInputStream1.close();
        fileInputStream2.close();

  /*      while((b = fis.read())!=-1) {
            //把b中的内容写出到fos关联的文件中
            fos.write(b);
        }*/

    }
}
